import java.util.Scanner;

public class test {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int m = scanner.nextInt();
        int n = scanner.nextInt();
        int a = m%n;
        while(a !=0){
            a = m % n;
            m = n;
            n = a;
        }
        System.out.println("这俩个数的最大公约数为 "+ n);

    }






    public static void main3(String[] args) {
        int i = 0;
        int j = 0;
        double n = 0;
        double a = 0;
        for(i=1;i<=99;i+=2){
            n += 1.0/i;
        }
        for(j=2;j<=100;j+=2){

           a -= 1.0/j;
        }

        System.out.println(n+a);
    }









    public static void main2(String[] args){
        int i = 1;
        boolean bool = true;
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入一个要判断素数的数 ");
        int n = scanner.nextInt();

            for (i = 2; i < n; i++) {
            if(n% i ==0){
                bool = false;
            }
            }
        if(bool){
            System.out.println(n + "为素数");
        }else{
            System.out.println(n + "不为素数");
        }

    }





    public static void main1(String[] args) {
        int i = 1;
        int count = 0;
        while (i <= 100) {
            if (i % 10 == 9 && i / 10 != 9) {
                count++;
            }
            if (i % 10 == 9 && i / 10 == 9) {
                count++;
                count++;
            }
            i++;
        }
        System.out.println("数字9 出现的次数" + count);
    }
}